package com.fly.springbootTemplate.serviceImpl;

import com.fly.springbootTemplate.dao.StudentDao;
import com.fly.springbootTemplate.entity.Student;
import com.fly.springbootTemplate.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

@Service
public class StudentServiceImpl implements StudentService {
    @Autowired
    private StudentDao studentDao;
    @Override
    public boolean addStudent(Student student) {
        return studentDao.insertStudent(student);
    }

    @Override
    public boolean deleteStudent(Integer sno) {
        return studentDao.deleteStudent(sno);
    }

    @Override
    public boolean updateStudent(Student student) {
        return studentDao.updateStudent(student);
    }

    @Override
    public List<Student> getAllStudent() {
        return studentDao.selectAllStudent();
    }

    @Override
    public Student getStudentBySno(Integer sno) {
        return studentDao.selectStudentBySno(sno);
    }

    @Override
    public boolean updateStudentByItem(Student student) {
        return studentDao.updateStudentByItem(student);
    }

    @Override
    public boolean addBatchStudent(List<Student> students) {
        return studentDao.insertBatchStudent(students);
    }

    @Override
    public boolean updateBatchStudent(List<Student> students) {
        return studentDao.updateBatchStudent(students);
    }
}
